package com.ma.process.controller.api;

import com.ma.common.result.Result;
import com.ma.model.process.ProcessTemplate;
import com.ma.process.service.OaProcessTemplateService;
import com.ma.process.service.OaProcessTypeService;
import com.ma.process.service.ProcessService;
import com.ma.vo.process.ProcessFormVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "审批流管理")
@RestController
@RequestMapping("/admin/process")
@CrossOrigin //跨域
public class ProcessApiController {
    @Autowired
    private OaProcessTypeService processTypeService;
    @Autowired
    private OaProcessTemplateService processTemplateService;
    @ApiOperation("获取全部审批分类及模板")
    @GetMapping("findProcessType")
    public Result findProcessType(){
        return Result.ok(processTypeService.findProcessType());
    }

    @ApiOperation(value = "获取审批模板")
    @GetMapping("getProcessTemplate/{processTemplateId}")
    public Result get(@PathVariable Long processTemplateId){
        ProcessTemplate template = processTemplateService.getById(processTemplateId);
        return Result.ok(template);
    }
}
